{{multiple issues|
{{More footnotes|date=May 2013}}
{{one source|date=May 2015}}
{{Refimprove|date=April 2008}}}}
File:Winpdb-1.3.6.png|thumb |Winpdb debugging itself

A '''debugger''' or '''debugging tool''' is a computer program that is used to software testing|test and debugging|debug other programs (the "target" program). The code to be examined might alternatively be running on an ''instruction set simulator'' (ISS), a technique that allows great power in its ability to halt when specific conditions are encountered, but which will typically be somewhat slower than executing the code directly on the appropriate (or the same)
processor. Some debuggers offer two modes of operation, full or partial simulation, to limit this impact.

A "trap (computing)|trap" occurs when the program cannot normally continue because of a software bug|programming bug or invalid data. For example, the program might have tried to use an instruction not available on the current version of the central processing unit|CPU or attempted to access unavailable or memory protection|protected memory (computers)|memory. When the program "traps" or reaches a preset condition, the debugger typically shows the location in the original
code if it is a '''source-level debugger''' or '''symbolic debugger''', commonly now seen in integrated development environments. If it is a '''low-level debugger''' or a '''machine-language debugger''' it shows the line in the disassembly (unless it also has online access to the original source code and can display the appropriate section of code from the assembly or compilation).

==Features==
Typically, debuggers offer a query processor, a symbol resolver, an expression interpreter, and a debug support interface at its top level.Aggarwal and Kumar, p. 302. Debuggers also offer more sophisticated functions such as running a program stepping (debugging)|step by step ('''single-stepping''' or program animation), stopping ('''breaking''') (pausing the program to examine the current state) at some event or specified instruction by means of a breakpoint,
and tracking the values of variables.Aggarwal and Kumar 2003, p. 301. Some debuggers have the ability to modify program state while it is running. It may also be possible to continue execution at a different location in the program to bypass a crash or logical error.

The same functionality which makes a debugger useful for eliminating bugs allows it to be used as a software cracking tool to evade copy protection, digital rights management, and other software protection features. It often also makes it useful as a general verification tool, fault coverage, and Profiling (computer programming)|performance analyzer, especially if instruction path lengths are shown.Aggarwal and Kumar, pp. 307-312.

Most mainstream debugging engines, such as gdb and dbx (debugger)|dbx, provide console-based command line interfaces. Debugger front-ends are popular extensions to debugger engines that provide Integrated Developer Environment|IDE integration, program animation, and visualization features.

==={{anchor|Reverse debugging}}Reverse debugging===
<!-- At least six pages redirect to this section. Please do not remove the section or rename the anchor, without first getting consensus on the talk page. -->
Some debuggers include a feature called "'''reverse debugging'''", also known as "historical debugging" or "backwards debugging". These debuggers make it possible to step a program's execution backwards in time. Various debuggers include this feature. Microsoft Visual Studio (2010 Ultimate edition, 2012 Ultimate, 2013 Ultimate, and 2015 Enterprise edition) offers IntelliTrace reverse debugging for C#, Visual Basic .NET, and some other languages, but not C++. Reverse debuggers also
exist for C, C++, Java, Python, Perl, and other languages. Some are open source; some are proprietary commercial software. Some reverse debuggers slow down the target by orders of magnitude, but the best reverse debuggers cause a slowdown of 2× or less. Reverse debugging is very useful for certain types of problems, but is still not commonly used yet.{{cite web|author1=Philip Claßen|author2=Undo Software|title=Why is reverse debugging rarely
used?|url=http://programmers.stackexchange.com/questions/181527/why-is-reverse-debugging-rarely-used|work=Programmers Stack Exchange|publisher=Stack Exchange, Inc|accessdate=12 April 2015}}

==Language dependency==
Some debuggers operate on a single specific language while others can handle multiple languages transparently. For example, if the main target program is written in COBOL but calls assembly language subroutines and PL/1 subroutines, the debugger may have to dynamically switch modes to accommodate the changes in language as they occur.

==Memory protection==
Some debuggers also incorporate memory protection to avoid storage violations such as buffer overflow. This may be extremely important in transaction processing environments where memory is dynamically allocated from memory 'pools' on a task by task basis.

==Hardware support for debugging==
Most modern microprocessors have at least one of these features in their CPU design to make debugging easier:
Hardware support for single-stepping a program, such as the trap flag.
An instruction set that meets the Popek and Goldberg virtualization requirements makes it easier to write debugger software that runs on the same CPU as the software being debugged; such a CPU can execute the inner loops of the program under test at full speed, and still remain under debugger control.
In-system programming allows an external hardware debugger to reprogram a system under test (for example, adding or removing instruction breakpoints). Many systems with such ISP support also have other hardware debug support.
Hardware support for code and data breakpoints, such as address comparators and data value comparators or, with considerably more work involved, page fault hardware.Aggarwal and Kumar 2003, pp. 299-301.
Joint Test Action Group#Example: ARM11 debug TAP|JTAG access to hardware debug interfaces such as those on ARM architecture processors or using the Nexus (standard)|Nexus command set. Processors used in embedded systems typically have extensive JTAG debug support.
Micro controllers with as few as six pins need to use low pin-count substitutes for JTAG, such as Background debug mode interface|BDM, Spy-Bi-Wire, or debugWIRE on the Atmel AVR. DebugWIRE, for example, uses bidirectional signaling on the RESET pin.

==Debugger front-ends==
Some of the most capable and popular debuggers implement only a simple command line interface (CLI)—often to maximize porting|portability and minimize resource consumption. Developers typically consider debugging via a graphical user interface (GUI) easier and more productive. This is the reason for visual front-ends, that allow users to monitor and control subservient CLI-only debuggers via graphical user interface. Some GUI debugger front-ends are designed to
be compatible with a variety of CLI-only debuggers, while others are targeted at one specific debugger.

==List of debuggers==
{{main|List of debuggers}}
{{example farm|date=June 2015}}
Some widely used debuggers are:
Firefox JavaScript debugger
GNU Debugger|GDB - the GNU debugger
LLDB (debugger)|LLDB
Microsoft Visual Studio Debugger
Valgrind
WinDbg
Eclipse (software)|Eclipse debugger API used in a range of IDEs: Eclipse IDE (Java) Nodeclipse (JavaScript)
WDW, the Watcom C/C++ compiler|OpenWatcom debugger

Earlier minicomputer debuggers include:
Dynamic debugging technique (DDT)
On-line Debugging Tool (ODT)

Earlier Mainframe debuggers include (in date of release order):
1985 CA/EZTEST
1990 XPEDITER and Expediter CICS

Current mainframe debuggers:
Debug Tool for z/OS {{cite web|url=ftp://public.dhe.ibm.com/software/htp/pdtools/info/DatasheetDT.pdf |format=PDF |title=IBM Debug Tool for z/OS, V13.1 |publisher=Puiblic.dhe.ibm.com |accessdate=2015-05-07}}
XPEDITER and Expediter CICS
z/XDC {{cite web|url=http://www-304.ibm.com/partnerworld/gsd/solutiondetails.do?solution=48514&lc=en&stateCd=P&tab=2 |title=IBM Global Solutions Directory - z/XDC Extended Debugging Controller z2.1 |accessdate=2015-05-29}}

==See also==
{{Portal|Software Testing|Computer programming}}
<!-- Please keep entries in alphabetical order & add a short description WP:SEEALSO -->
{{columns-list|colwidth=30em|
Comparison of debuggers
Core dump
Kernel debugger
List of tools for static code analysis
Memory debugger
Packet analyzer
Profiling (computer programming)|Profiling
}}
<!-- please keep entries in alphabetical order -->
{{Clear}}

==References==
;General
{{cite encyclopedia|authors=Sanjeev Kumar Aggarwal and M. Sarath Kumar|title=Debuggers for Programming Languages|encyclopedia=The Compiler Design Handbook: Optimizations and Machine Code Generation|editors=Y.N. Srikant and Priti Shankar|location=Boca Raton, Florida|publisher=CRC Press|isbn=978-0-8493-1240-3|year=2003|pages=295–327}}
{{cite book|authors=Jonathan B. Rosenberg|title=How Debuggers Work: Algorithms, Data Structures, and Architecture|publisher=John Wiley & Sons|isbn=0-471-14966-7}}
;Specific
{{Reflist|30em}}

==External links==
{{Wiktionary|debugger}}
{{dmoz|/Computers/Programming/Development_Tools/Debugging|Debugging tools}}
[http://www.microsoft.com/whdc/devtools/debugging/ Debugging Tools for Windows]
[http://www.openrce.org OpenRCE: Various Debugger Resources and Plug-ins]
{{dmoz|/Computers/Parallel_Computing/Programming/Tools/|Parallel computing development and debugging tools}}
[https://msdn.microsoft.com/en-us/library/dd264915.aspx/ IntelliTrace] MSDN, Visual Studio 2015

Category:Debuggers| 
Category:Debugging
Category:Utility software types

